CXX=g++
CXXFLAGS=-fPIC -Wall -Winline -g  -D_FILE_OFFSET_BITS=64

TARGET=hz

TOPDIR =$(PWD) 

OBJS += hz.o
OBJS += bwt.o
OBJS += mtf.o
OBJS += rle.o
OBJS += huffman.o

INCPATH=-I. -I ../include -I../../include
all:$(TARGET)
	@echo make all
$(TARGET):$(OBJS)
	@echo make target
	$(CXX) $(CXXFLAGS) $(INCPATH) $^ -o $@ 
bwt.o:$(PWD)/cluster/bwt/bwt.cpp
	@echo compiling $<
	$(CXX) $(CXXFLAGS) $(INCPATH) -c $< 
mtf.o:$(PWD)/step/mtf/mtf.cpp
	@echo compiling $<
	$(CXX) $(CXXFLAGS) $(INCPATH) -c $< 
rle.o:$(PWD)/step/rle/rle.cpp
	@echo compiling $<
	$(CXX) $(CXXFLAGS) $(INCPATH) -c $< 
huffman.o:$(PWD)/storage/huffman/huffman.cpp
	@echo compiling $<
	$(CXX) $(CXXFLAGS) $(INCPATH) -c $< 
hz.o:hz.cpp
	@echo compiling $<
	$(CXX) $(CXXFLAGS) $(INCPATH) -c $< 
.PHONY install:
install:
.PHONY clean:
.PHONY test:
test:
	@echo Testing encode and decode
	cat /dev/null > dst
	./hz -e -i src -o dst -1
	cat /dev/null > tmp
	./hz -d -i dst -o tmp -1
	ls -l src dst
	diff src tmp
clean:
	@echo make clean
	-rm -f  $(OBJS) $(TARGET)
